<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
	font-size: 18px;
	font-weight: bold;
}
body {
	margin-left: 1cm;
	margin-right: 1cm;
}
-->
</style>
</head>

<body>
<div align="center">
  <p class="style1">Tutorial to guide new users with the basics</p>
  <p align="left"><B> Get to know AMAI.</B><a name="knowAMAI"></a><BR>
    If you downloaded this software and read this far you already know that AMAI is a sophisticated version of the ordinary AI found in warcraft 3, so let us get on to the instructions on how to work with AMAI to make it operate with it's full potential.<BR>
Everything you need to do to make AMAI do your bidding is to setup some goals and settings. There are several different setting levels, like strategy specific setting, race specific settings and global settings that are applied no matter what race and strategy AMAI uses.<BR>
The goals are what AMAI does. The build sequence that every strategy consists of is simply a list of the goals, where you tell AMAI what to do, how many to make and how important it is that it is done. There isn't much more to be said here, since you don't need to know much about AMAIs functions to make it work. Just follow the instruction steps for the different activities in the following sections and you will understand how easy this really is.<BR>
<BR>
<BR>
<B>Making a profile.</B><a name="MakeProfile"></a><BR>
If you used AMAI before you probably noticed that when the game is ongoing and at the end screens all computers get names instead of 'Computer(Normal)'. The meaning of this is to personalize the computers better and giving them an individual feel.<BR>
Some might think the names are only names but that is not the case. Behind every name is some unique settings, the 'profile settings'. These are different for every profile and give them a personality. For example the computer named '[AMAI]Aggressario' is a aggressive computer that dares to attack stronger foes and he also got some other properties like switching strategy more often and expand early.<BR>
Currently AMAI has got 26 different profiles but got room for some more if you want to add a personal one to the list so it got a chance of getting randomly picked by one of the computers in the game. Or maybe you want to remove or edit the current profiles to get an own list of profiles that you can keep to use with all future versions of AMAI.<BR>
You will also be able to upload your own profiles and download other profiles from a database on internet, read more about this in the strategy exchange section.<BR>
<BR>
Before playing around with AMAI profiles there is one limit you need to keep in mind:<BR>
There have to be at least 11 different profiles since AMAI pick a unique profile for every computer in the game, there will be trouble if a game is started and there are more computers than names on the profile list.<BR>
<BR>
Lets get started. I will be making a new profile named 'Willy' and in detail describe every step I take to do so.<BR>
<BR>
Make sure you installed Perl as instructed in the requirements section and after this you can run the strategy manager in AMAI directory 'AMAIStrategyManager.pl'.</p>
  <p align="left"><img src="../images/Strategy%20Manager.JPG" width="287" height="437"></p>
  <p align="left">Now press the "profiles" tab to get to the list of profiles that is currently installed in AMAI. Make a new profile by pressing the button 'New' to the right and select the profile "New_Profile" that should have appeared at the bottom of the list.</p>
  <p align="left"><img src="../images/Manager2.JPG" width="288" height="437"></p>
  <p align="left">After this we want to customize this profile and give it a name. To do so we need to open it in the profile editor. Hit the button 'Edit' to the right to bring forth this editor with "New_Profile" selected.<BR>
The editor should now appear. We start by giving our new computer player the name of "Willy".</p>
  <p align="left"><img src="../images/profile1.JPG" width="502" height="577"></p>
  <p align="left"><strong>Race</strong> <BR>Change this to a desired race available to make this profile only be picked if computer is a certain race. This is left at Random by Default.
  <p align="left"><B>Aggression</B> recommended: -10 to 10<BR>
    This is usually a value between -10 and 10. A higher number means more aggressive while a lower means less aggressive. By many tests I have found out that computers work best if they are less agressive but that might have changed due to recent changes in the features. It's hard to know. However to be on the safe side I fill in -6 for Willy meaning he will only dare to attack a opponent if the opponents force is 6 strengthpoints smaller than his own force.<BR>
<BR>
<B>Uncertainty</B> recommended: 5 to 15<BR>
This is one of the things we have to decrease the amount of cheating in the AI. This is how false the information about the enemies strength can be. For example 6 means this computer will get the strength of the enemy force +-6 points or less of the actual strength value.<BR>
First you might think you do the computer a big favor by setting this to 0 but thats actually wrong. In many cases it's good that the uncertainty makes the computer attack a stronger opponent that might not be home to defend his own base at the moment and just because this computer was lucky he then wins instead of sitting at home knowing that the enemy force is stronger and therefor not dare to attack.<BR>
I set this to 5 for Willy so he still knows the enemy pretty accurate.<BR>
<BR>
<B>Minimum Attack Strength</B> recommended: 6 to 9<BR>
This is a number for how strong this computers army must be before it dares to leave the base to attack the enemy or do some creeping, for example a hero and a footman is 5+4 strength points(almost double the food value for units with exception of heroes) this mean if this computer got a 6 here it will not attack until it got both the hero and at least 1 military unit completed.<BR>
I give Willy a 8 here so he doesn't try to leave base and get his units killed becuse he used a too small force.<BR>
<BR>
<B>Build Farm at left food</B> recommended: 6 to 12<BR>
This setting tells how much free food there can be left before it is ordered to build another farm or whatever building it has that produces more food.<BR>
Willy gets 8 here meaning that when his food use is 8 less than his total food capacity he builds another farm.<BR>
<BR>
<B>First expansion time</B> recommended: -10 to 10<BR>
A small influence on this computers expansion time, it's counted in units of 5 seconds meaning that a 5 will allow Willy expand 25 seconds later than usual or -5 will allow Willy to expand 25 seconds earlier than normal.(5*5=25)<BR>
Willy gets a 6 here.(allowing him to expand 30 seconds later than usual)<BR>
The base expansion time is depending on what strategy is used since it differs from different strategies. Look it up in the strategy making part of this manual.<BR>
<BR>
<B>Second expansion time</B> recommended: -20 to 20<BR>
Same as the first but it's the influence for when this computer is allowed to make a second expansion. Remember that for both of these cases it doesn't mean that a computer 'will' make a expansion exactly when this time has passed, it will only be allowed to make a expansion. The computer can find out on it's own if it's in need of an expansion.<BR>
Willy gets -10 here. (allowing Willy to make second expansion 50 seconds earlier than normal)<BR>
<BR>
<B>Strategy Persistence</B> recommended: 500 to 1500<BR>
this is how much the computer wants to keep using the current strategy. This mean that a lower value here will make the computer change strategy more often and therefor react faster on what the enemy does and counter it. But changing strategy more often isn't only good for the computer since it will ruin all it's current plans. For example a Orc computer might be using a strategy that builds grunts so it starts by building a barrack and just before the barrack is completed it discovers that the enemy got lots of ground attack units and decides to use a mass wyvern strategy instead. Now the barrack was built in vain. Such things are avoided by using a higher strategy persistance.<BR>
I give Willy a good average number of 900 here so he won't change strategy too often.<BR>
<BR>
<B>Influences number of factories built</B> recommended: 0.9 to 1.0<BR>
This value is a part used in the computer's formula for calculating if they got enough income to be able to make use of extra buildings for faster unit production. The higher this value, the more unit production buildings of a type are built. As an example a human computer uses a strategy that builds lots of riflemen from one barrack. After this computer completes an expansion and starts to gain gold faster it might consider building another barrack to spend the higher income on producing riflemen much faster. Depending on this value it might do that or not.<BR>
Willy gets the good average number 0.9 here.<BR>
<BR>
<B>Taunt rate</B> recommended: 0 to 2<BR>
This is how often this computer will display a taunt message. For now all profile got the value 1 becuse it has prooven to be a good avrage value. Every 5th second of game time the function that decides if a computer is going to taunt is executed, when that hapens it's the chanse of this value in % if the computer shall display a taunt chat message. '1' says that the computer will display a chat messege every 5th second 1% of the time. For Willy I enter 0.5 here since I don't want him to talk very often.<BR>
<BR>
<B>Expansion target bonus</B> recommended: 0 to 20<BR>
This is an added aggression bonus if an enemy expansion is targeted for attack. Meaning that the higher this value is the more often will the computer dare to attack an enemy expansion.<BR>
Willy gets 8 here.<BR>
<BR>
<B>Hard coded AI target bonus</B> recommended: 0 to 20<BR>
Same as the expansion target bonus but this is aggression added for targets selected by the hard coded AI made by Blizzard. These targets will most of the time be enemy expansions or backstabbing enemy forces that currently engage larger creeps nearby.<BR>
Willy gets 6 here.<BR>
<BR>
<B>Hard coded AI target rate</B> recommended: 0.3 to 0.8<BR>
This is how often AMAI lets the hardcoded AI choose target instead of AMAI itself. A higher number closer to 1 means that the computer will attack expansions and backstab enemy forces more often while closer to 0 will make the computer creep more and attack enemy bases if enemy force is weak. Willy gets 0.5 making it a 50% chance that AMAI or hard coded AI choose a target.<BR>
</p>
  <p align="left"><strong>Surrender Value </strong>recommended: 0 to 4<BR>
    This is how forceful a profile will keep fighting. A higher number makes computer give up more easily while a lower value will make it almost impossible for that profile to give up in a fight. A value of 0 is the default blizzard setting which defeats only when every single unit is destroyed.</p>
  <p align="left"><BR>
    <B>Favorite hero</B><BR>
This effects in a small way what hero Willy will use the most for every race. For example if 'ARCHMAGE' is Willys favorite hero for Human he will more likely be using that hero. There is even a small chance that he will pick the Archmage hero even if the strategy used has no priority at all for that hero.<BR>
Just go ahead and give Willy a favorite hero of your choice for every race.<BR>
<BR>
<B>Favorite unit</B><BR>
Like the favorite hero this effects how Willy plays in a small way but probably in a larger way than the favorite hero since it has influence on what strategies Willy is going to use when playing. For example if Willy's favorite Night Elf unit is 'HUNTRESS' he will most likely use strategies that orders him to build lots of huntresses. Of course he will still switch to a strategy that better counters what the enemy got if huntress don't work but he rather sticks to huntress most of time since it's his favorite unit.</p>
  <p align="left"><BR>
  Willy should now look something like this.<BR>
  <img src="../images/Profile2.JPG" width="503" height="578"></p>
  <p align="left">After filling in all the settings for Willy I can now save this profile by hitting the ok button. Willy is created,but before you can play with or against Willy you will have to compile AMAI then install it to the maps you want to play. There is always a chance that Willy will be one of the computers in the game and that computer will have the peronality you just created.</p>
  <p align="left"> As I said you must compile AMAI and since you probably not know how to do that yet that will be what you will learn in the next section of this manual.</p>
  <p align="left"><B>Compiling your AMAI.</B><a name="CompileAMAI"></a><BR>
    This is very simple if you still got the strategy manager open. You just need to hit the 'Compile' button to the left and there will be a progress report in the perl window that you probably already got minimized so after you hit the button bring it up.<BR>
    <img src="../images/Compile1.jpg" width="669" height="338"></p>
  <p align="left"><em>USEFUL TIP -- Clicking &quot;compile, Optimize&quot; will make your compiled files smaller and more effecient. </em></p>
  <p align="left">Now the compiler will make the 5 .ai files for the TFT version of AMAI. After the 5 files has been compiled the DOS window will ask you to press a button to continue so just press a button. after this we can now just run the installer AMAI.exe to install the newely compiled AMAI to a map of your choice and start playing with the changes you just have made.</p>
  <p align="left">Another method is to just navigate to the scripts folder, select TFT and run the simple edition .bat file there. This includes your updated profile but allows you to play on any map without having to install first.</p>
  <p align="left"><B> Making a strategy.</B><a name="MakeStrategy"></a><BR>
  AMAI has already got about 8 different strategies for every race but theoritically it should support an unlimited amount of different strategies. We start this section by starting the perl program 'AMAIStrategyManager.pl' that will bring you this menu. </p>
  <p align="left"><img src="../images/Strategy%20Manager.JPG" width="287" height="437"></p>
  <p align="left">What you currently see here as the left buttons indicate is all strategies for NightElf in the TFT version of AMAI.<BR>
With this strategy manager you will be able to exchange strategies with other users of AMAI by using the Insert and Extract buttons. From here you also find the editor. We start to learn how to make strategies by looking at an existing strategy. Start with selecting the human race instead by pressing the left button that now indicates 'ELF', after this the list has changed to display the human strategies. Now press the strategy named 'Rifle'.</p>
  <p align="left"><img src="../images/Manager3.JPG" width="292" height="457"></p>
  <p align="left">Now press the right button 'Edit' that will open the editor with this strategy.</p>
  <p align="left"><img src="../images/Strategy1.JPG" width="1019" height="769"></p>
  <p align="left"><B>Strategy Function Name</B><BR>
    This is the working name of the strategy that will be used by the program files.<BR>
<BR>
<B>Default Name</B><BR>
This is the name the strategy is known by in game unless there is another language version of this name in the translation tables.<BR>
<BR>
<B>Default Report</B><BR>
This is what a computer says when it's starting to use this strategy unless there is another translation for this matching the used language when playing.<BR>
<BR>
<B>key_building1</B><BR>
This is the main building used by this strategy for unit prodution and most other needs. It is used for identifying this strategy as a better choice for a computer that needs to build something that counters the enemy forces that might got alternative solutions. For example a computer that has one workshop and one barrack might consider both mass flying machines and mass riflemen as good choices to counter an enemy air force, but if the computer instead has 2 barracks and no workshop the choice will more clearly point to this strategy since it already got one of the buildings mainly needed to create riflemen.<BR>
<BR>
<B>key_building2</B><BR>
This is used to define a second key building that will enforce the priority for this strategy in the same way as key_building1. Should be the second most used building for this strategy.<BR>
<BR>
<B>key_upgrade1</B><BR>
In same way as for key buildings this is the upgrade mostly used for this strategy. The higher level this upgrade is the more the computer already got of what is to be built in this strategy. This makes the strategy look like a 'best choice' if a computer is in need of the other properties for this strategy.<BR>
<BR>
<B>key_upgrade2</B><BR>
Same as for key upgrade 1 but this is the second most used upgrade.<BR>
<BR>
<B>key_unit</B><BR>
This is the unit most used by this strategy and is used in a similiar way as key building and upgrade. The more units of this kind the computer got the more good looking is the strategies having this unit as key unit next time the computer is about to change strategy.<BR>
<BR>
<B>beginning_strat</B><BR>
Set this to true if this strategy is allowed to be used as a starting strategy at the beginning of a game. Set this to false if your strategy is more meant to be enhancing an already established strategy and has no good goals for tier 1.<BR>
<BR>
<B>strat_minimum_time</B> recommended: 20 to 50<BR>
This is how long time this strategy will be used as a minimum before a new strategy change is allowed. This usually is set to an estimated time it takes for this strategy to establish itself, therefor this time is only true for tier 1. If this strategy is selected in tier 2 this time will only be 2/3 of whats entered here, if it's in tier 3 it will be only 1/3 of this time.<BR>
<BR>
<B>strategy_type</B><BR>
The major function of the strategy. Here are four options: ranged, melee, air and casters. The use is that allied computers will try to choose strategies of different aspects instead of going both melee for example.<BR>
<BR>
<B>Main strategy tier</B> recommended: 1 to 3<BR>
This is in what tier this strategy operates best. For example a mass footmen strategy works best early(tier 1) in the game while a mass knight strategy works best later in the game(tier 3).<BR>
<BR>
<B>base rp</B> recommended: 20 to 30<BR>
This is the starting priority for this strategy. The higher this value is the more likely it is that the computers are going to use this strategy no matter what.<BR>
<BR>
<B>ally bonus</B> recommended: -18 to 18<BR>
If your strategy is good for team play you can enter a priority boost this strategy shall get if the computer selecting strategy has allied players. (it is a team game)<BR>
<BR>
<B>1on1 bonus</B> recommended: -18 to 18<BR>
If your strategy is good for 1on1 games you can enter a positive value here.<BR>
<BR>
<B>FFA bonus</B> recommended: -18 to 18<BR>
If the strategy fits well for FFA it really need some extra priority here, like 9 or 18.<BR>
<BR>
<B>Race bonus</B> recommended: -18 to 18<BR>
The following 9 settings is to give this strategy positive or negative priority boosts depending on what race enemy and allied players are.<BR>
Random enemy bonus is the bonus priority this strategy gets if an enemy is random race. The following settings explain themselves good enough. Human enemy bonus is priority added if an enemy is human and so on. The last 4 settings are depending on what race any allied player might be, for example orc ally bonus is priority added if a player is orc and is allied with the computer.<BR>
<BR>
<B>Strength bonus</B> recommended: -10 to 10<BR>
The next 11 settings are priorities on different things this strategy is good or bad to go against. For example anti air strength should be a pretty high positive value for this riflemen strategy since it's one of the best human strategies to counter enemy air units. It's also a strategy using piercing attack meaning that it's pretty good at countering any units with light or unarmored armor so it should also have positives on anti unarmored strength and anti light armor strength.<BR>
However this strategy also has down sides such as riflemen having medium armor making them very bad vs melee attackers using normal attack. This makes the riflemen strategy get a negative value on anti normal strength.<BR>
<BR>
<B>Anti air strength</B> - How good this strategy is against enemy air units.<BR>
<B>Anti caster strength</B> - How good this strategy is against enemy support units.<BR>
<B>Anti tower strength</B> - How good this strategy is against enemy defensive buildings.<BR>
<B>Anti piercing strength</B> - How good this strategy is against enemy piercing attack units.<BR>
<B>Anti normal streangth</B> - How good this strategy is against enemy normal attack units.<BR>
<B>Anti siege strength</B> - How good this strategy is against enemy siege attack units.<BR>
<B>Anti magic strength</B> - How good this strategy is against enemy magic attack units.<BR>
<B>Anti unarmored strength</B> - How good this strategy is against unarmored enemy units.<BR>
<B>Anti light armor strength</B> - How good this strategy is against enemy light armor units.<BR>
<B>Anti medium armor strength</B> - How good this strategy is against enemy medium armor units.<BR>
<B>Anti heavy armor strength</B> - How good this strategy is against enemy heavy armor units.<BR>
<BR>
<B>Expansion time</B> recommended: 30 to 90<BR>
The time a computer using this has to wait before it is allowed to build the first expansion. The value is in units of 5 seconds meaning that 80 tells the computer to not expand until a gametime of 80*5 seconds has passed.<BR>
The computer will not build an expansion exactly after this time has passed. It will only be allowed to build one, it will know by itself if it needs an expansion yet.<BR>
<BR>
<B>Second expansion time</B> recommended: 100 to 200<BR>
The time a computer using this has to wait before it's allowed to build the second expansion. The value is in units of 5 seconds meaning that 80 tells the computer to not expand until a gametime of 80*5 seconds has passed.<BR>
Both these values are influenced in a small way by what profile is being used as well.<BR>
<BR>
<B>First hero bonus</B><BR>
If you want a certain hero to be used more often as first hero with this strategy it should be selected here. Note though that that will only have an influence if this strategy is chosen as starting strategy.<BR>
<BR>
<B>First hero bonus amount</B> recommended: 10 to 30<BR>
How high priority boost you want to give this hero as first hero. If you want to enforce a certain hero, use a very high value.<BR>
<BR>
<B>Second hero bonus</B><BR>
This is the same as the previous 2 settings but for second hero.<BR>
<BR>
<B>Second hero bonus amount</B> recommended: 10 to 30<BR>
Priority boost for the selected hero to be used as second hero.<BR>
<BR>
<B>Aggression bonus</B> recommended: -10 to 10<BR>
The following 12 settings sets how aggressive the computer using this strategy should be in different cases.<BR>
<B>enemy_elf add agg</B> - Changed aggression vs enemy night elf players in tier 1, 2 and 3.<BR>
<B>enemy_human add agg</B> - Changed aggression vs enemy human players in tier 1, 2 and 3.<BR>
<B>enemy_orc add agg</B> - Changed aggression vs enemy orc players in tier 1, 2 and 3.<BR>
<B>enemy_undead add agg</B> - Changed aggression vs enemy undead players in tier 1, 2 and 3.<BR>
<BR>
You probably wonder why most of these settings are unused for the current strategies and thats becuse we don't know what values should be here to give best result. If you feel the same for any settings you should leave them blank or ask a good player for assistance on how the strategy should be played in different cases. If you just fill in random settings the results can be worse than just blank values. Blank here does not mean leaving the fields empty but putting a 0 in the fields.<BR>
<BR>
<BR>
That were all settings for strategies, now lets try to learn the most advanced part of this editor, the coding of build goals.<BR>
This is about the 4 textfields to the left in the editor. The top area is for strategy initalisation code and the other three are for different tiers.<BR>
</p>
  <p align="left"><B>Initalisation code</B><BR>
    This part is seldomly used but it can be used for some strategies if you want to make a really optimized build order at the start of the game like in this case for riflemen or if you want to define some harass groups for the computer using this strategy.<BR>
Harassing is a new features in AMAI 2.0 and might not be as good as real harassing but it's good enough for annoying opponents.<BR>
But first lets take a look at what we currently see in this text field and take up what it is.</p>
  <p align="left"><em>ADD BLOCK STATEMENTS </em></p>
  <p align="left">call AddBlock(<B>1, BLACKSMITH, false, 1, HOUSE, 60</B>)<BR>
    call AddBlock(<B>1, BLACKSMITH, false, 9, PEASANT, 60</B>)<BR>
<BR>
Both lines have the same function "AddBlock" this can be used to prevent the computer from doing something before it has done something else or before a certain time has passed. In this case the first line tells this computer that it should not build more than 1 human farm (<B>1, HOUSE,</B>) unless it has already started to build at least 1 blacksmith(<B>1, BLACKSMITH, false,</B>) or if 60*5 seconds have passed since game start.(<B>60</B>)<BR>
The second AddBlock call tells this computer that it should not build more than 9 workers(<B>9, PEASANT,</B>) unless it has started to build a blacksmith(<B>1, BLACKSMITH, false,</B>) or 60*5 seconds have passed.(<B>60</B>)<BR>
If you are not very familiar with coding this might look confusing but this is how the parameters work:<BR>
<BR>
<B>call AddBlock([</B>How many must it build or start to build<B>], [</B>What must it have built or started to build<B>], [</B>Should the first value count started to build(false) or completed build(true)<B>], [</B>How many is it allowed to build before it has to obey the condition stated in the 3 first parameters<B>]</B>,<B>[</B>What is it it is allowed to build this many of at a maximum<B>], [</B>How many game seconds *5 shall pass before this block is turned off<B>])</B><BR>
<BR>
For example I can show this completely different block:<BR>
<BR>
call AddBlock(<B>1</B>, <B>HUMAN_ALTAR</B>, <B>true</B>, <B>0</B>, <B>ARCANE_VAULT</B>, <B>36</B>)<BR>
<BR>
This block prevents the human computer from starting to build any shop( <B>0, ARCANE_VAULT,</B>) unless at least 1 altar has been completed(<B>1, HUMAN_ALTAR, true,</B>) or 180 game seconds have passed(<B>36</B>).<BR>
This block is in global strategy initalisation unreachable from this editor but it's there to prevent any computer from building the shop too early.</p>
  <p align="left"><em>HARRASS GROUP </em></p>
  <p align="left">call AddHarass(<strong>2, 2, RIFLEMAN</strong>)<br>
set distraction_group = <strong>2</strong></p>
  <p align="left">As you can see much more simple than a block. This adds 2 Riflemen(<B>2, RIFLEMAN) </B> to harass group 2(<strong>2</strong>).</p>
  <p align="left">Now with this harrass group we can do multiple tasks with it. Here the harass group has been stated as a distraction group. ( <strong>= 2) </strong>This means when the computer has at least 6 riflemen the computer will use 2 of them to do a distraction attack. This is sort of a attack to distract the enemy from the main attack the computer is doing.</p>
  <p align="left">There are also other types of harrass commands that can be used.</p>
  <p align="left">call Harass(<B>1</B>, <B>HARASS_TARGET_PEONS</B>, <B>true</B>, <B>5</B>, <B>0.25</B>, <B>0</B>, <B>true</B>, <B>50</B>, <B>80</B>)<BR>
    <BR>
  This will make the human computer using this strategy to send harass group 1(<B>1</B>) to attack enemy workers(<B>HARASS_TARGET_PEONS</B>) but it will avoid towers(<B>true</B>). It will flee back if it encounters enemy units of a strength that is at least 5(<B>5</B>) and will abort the harass and move home again if they have less than 25% HP left(<B>0.25</B>) or there is only 0 units left alive in the harass group(<B>0</B>). It will repeat this harass every 50*5 seconds(<B>50</B>) but not make the first harass attempt until 80*5 seconds have passed(<B>80</B>).</p>
  <p align="left"><B>Other harass targets:</B><BR>
    HARASS_TARGET_PEONS - Enemy workers<BR>
HARASS_TARGET_EXPANSION - Enemy expansion<BR>
HARASS_TARGET_MAIN_HALL - Enemy main hall</p>
  <p align="left"><B>Code for Tier 1</B><BR>
    Now we are finaly getting somewhere. Here is the actual build sequence of AMAI and in this box every line represents a goal AMAI will try to accomplish as long as it is in tier1. This code is usually much more simple than the blocks and harass code.<BR>
We start by looking at one of the present lines here:<BR>
<BR>
call BuildUnit(<strong>10</strong><B>, RIFLEMAN, 48 </B>)<BR>
<BR>
The "BuildUnit" function is used to make the computer build units or buildings while the "BuildUpgr" function is for making upgrades. This specific line in "Code for Tier 1" tells this computer to build 10 riflemen(<B>10, RIFLEMAN,</B>) with a priority of 48(<strong>48</strong>) you might think at first. But this is not entirely true.<BR>
Because everytime you order a AMAI to build multiple units they will get a priority(<strong>48</strong>) boost of the unit amount(<strong>10</strong> - 1) *2. This means that the first rifleman will be ordered with a priority of 48 + (9 * 2), which is 66. But since for every rifleman built there is one less rifleman ordered the priority will be 2 lower for every rifleman. This mean that the final 10th rifleman will be built with the priority of 48 that is the actual priority given in the function call.<BR>
Now you might wonder what's the reason for this. So thats what Im going to explain here.<BR>
In the old standard ways of making build orders for warcraft3 AI the same order would have been given without the priority like this:<BR>
<BR>
call SetBuildUnit(<B>10, RIFLEMAN</B>)<BR>
<BR>
But usualy you want the computer to build more than just riflmen. So we add some footmen as well like this:<BR>
<BR>
call SetBuildUnit(<B>10, RIFLEMAN</B>)<BR>
call SetBuildUnit(<B>10, FOOTMAN</B>)<BR>
<BR>
Now what do you think this computer does?, well if you got some experience with normal war3 AI you know that it will first build 10 riflemen then it will build 10 footmen. But if you want it to build both riflemen and footmen parallelly then in the old ways of war3 AI you will have to do like this:<BR>
<BR>
call SetBuildUnit(<B>1, RIFLEMAN</B>)<BR>
call SetBuildUnit(<B>1, FOOTMAN</B>)<BR>
call SetBuildUnit(<B>2, RIFLEMAN</B>)<BR>
call SetBuildUnit(<B>2, FOOTMAN</B>)<BR>
call SetBuildUnit(<B>3, RIFLEMAN</B>)<BR>
call SetBuildUnit(<B>3, FOOTMAN</B>)<BR>
call SetBuildUnit(<B>4, RIFLEMAN</B>)<BR>
call SetBuildUnit(<B>4, FOOTMAN</B>)<BR>
call SetBuildUnit(<B>5, RIFLEMAN</B>)<BR>
call SetBuildUnit(<B>5, FOOTMAN</B>)<BR>
call SetBuildUnit(<B>6, RIFLEMAN</B>)<BR>
call SetBuildUnit(<B>6, FOOTMAN</B>)<BR>
call SetBuildUnit(<B>7, RIFLEMAN</B>)<BR>
call SetBuildUnit(<B>7, FOOTMAN</B>)<BR>
call SetBuildUnit(<B>8, RIFLEMAN</B>)<BR>
call SetBuildUnit(<B>8, FOOTMAN</B>) etc.......<BR>
    <BR>
    As you can see it's a whole bunch of code.<BR>
    Now behold the new and improved AMAI way to do this:<BR>
    <BR>
    call BuildUnit(<strong>10</strong>, RIFLEMAN, <B>50</B>)<BR>
    call BuildUnit(<strong>10</strong>, FOOTMAN, <B>50</B>)<BR>
    <BR>
    Yes these 2 lines give exactly the same result as the 20 rows above thanks to that amount of additional units * 2 priority add. it simply works like this since the first rifleman got a priority of 68(<B>50</B> + (<strong>10</strong>-1)*2) as I previosuly explained. as well got the first footman a priority of 68 since there is also <strong>10</strong> footman ordered. but since the riflemen are first the first unit built is the rifleman, then after the rifleman is built the next rifleman gets same priority -2 while the first footman still hasn't been built so it still got its priority of 68 and will be built after the rifleman. after this the computer got 1 rifleman and 1 footman and it has 9 rifleman and 9 footman more to build both now at a priority of 66.<BR>
    So it's all over again, first it builds another rifleman since it's above the footman in the code and got exactly the same priority. then another footman again. So the result now looks like this in the old code style:<BR>
    <BR>
    call SetBuildUnit(<B>1, RIFLEMAN</B>)<BR>
    call SetBuildUnit(<B>1, FOOTMAN</B>)<BR>
    call SetBuildUnit(<B>2, RIFLEMAN</B>)<BR>
    call SetBuildUnit(<B>2, FOOTMAN</B>)<BR>
    <BR>
    It will still continue to produce the full result of thoes 20 lines, ending with 10 riflemen and 10 footmen.<BR>
    <BR>
    Now lets take a look at a larger part of this tier 1 code for the Riflemen strategy:<BR>
    <BR>
    call BuildUnit(<strong>10, RIFLEMAN, 50</strong>)<BR>
    call BuildUnit(<strong>1, hero[1], 80</strong>)<BR>
    <BR>
    Here we got an order of 10 riflemen and the first hero.<BR>
    So what of this is going to be built first you think? Lets check.<BR>
    First we got 10 riflemen with a priority of 50, that gives the first rifleman the priority of 68(50+(10-1)+2).<BR>
    And lastly we got the hero with a priority of 80.<BR>
    This means that the hero gets built first. secondly it will continue with building riflemen until the rifleman priority is lower than the priority of the first footman so let's count.<BR>
    <BR>
    1. Hero1 80prio<BR>
    2. Rifleman 68prio<BR>
    3. Rifleman 66prio<BR>
    4. Rifleman 64prio<BR>
    5. Rifleman 62prio<BR>
    6. Rifleman 60prio<BR>
    7. Rifleman 58prio<BR>
    8. Rifleman 56prio<BR>
  9. Rifleman 54prio<BR>
  10. Rifleman 52prio<BR>
  11. Rifleman 50 prio<BR>
    DONE!<BR>
    <BR>
    Now this computer got an army already and is fully operational. Don't mind about the needed buildings, it knows what it needs and will build it.<BR>
    <BR>
    Another function could also be place here <BR>
    This for example:<BR>
    <BR>
    call BuildUpgr(<B>2, UPG_RANGED, 34</B>)<BR>
    <BR>
    Taken from the tier 2 code this upgrade order tells the computer to upgrade the ranged unit attack to level 2(<B>2, UPG_RANGED,</B>) with a priority of 34(<B>34</B>) and since the level 2 never was ordered it will upgrade that first of course with the 2*[additional amount] rule, that means the level 1 ranged upgrade is first done with the priority of 36. Works as I said just like the build function but is only used for upgrades.The new versions of AMAI no longer require you having to put the upgrade line in. The upgrades for units will be researched when amai sees fit. Putting this line in will force AMAI to research an upgrade which can be useful as AMAI may not always automatically research upgrades as promptly as you would like. <BR>
    <BR>
    By now you might have noticed that unit ordered first in the tier 1 code "merc_rush". This is a mercenary that will be bought if there is any mercenary camp on the map with a mercenary under the category merc_rush available.<BR>
    There are several different kinds of mercs that can be ordered just by making a build order on the category name.<BR>
    <BR>
    <B>merc_rush</B> - a weak but very early available mercenary of some kind.<BR>
    <B>merc_stopper</B> - a mercenary with some kind of entangle or ensnare abillity.<BR>
    <B>merc_caster</B> - a caster mercenary with no healing capabilities.<BR>
    <B>merc_healer</B> - a healer merc with some kind of healing spell.<BR>
    <B>merc_melee</B> - a stronger melee attacking mercenary.<BR>
    <B>merc_ranged</B> - a range attacking mercenary.<BR>
    <BR>
    In some cases the same mercenary can exist under multiple categorys but there is only 1 mercenary for each category or none.<BR>
    <BR>
    The tier 2 and tier 3 code windows have the same kind of code as the tier 1 window but usually more since it's possible to build more units and do more upgrades in the higher tiers.<BR>
    <BR>
    There are some other special build orders as well. In other human strategies orders calling "basic_melee". This is footmen or knights depending on what the computer can build for the amount number of food.<BR>
    <BR>
    call basic_melee(<B>50, 36</B>)<BR>
    <BR>
    This for example will build footmen or knights for the food value of <B>50</B> at the priority of <B>36</B>.<BR>
    <BR>
    My suggestion is that you take a look at different strategies for different races to see how they are made and then try to make your own strategy when you feel up to it.<BR>
    <BR> 
    <B>Making a new strategy</B><BR>
    Start by getting to the strategy manager and select the version and race your strategy shall be made for, then hit the button 'New' to the right.<BR>
Now a strategy by the name of New shall appear at the bottom of the list.<BR>
<img src="../images/Manager4.JPG" width="297" height="461"></p>
  <p align="left">Now hit the edit button to start making this strategy.</p>
  <p align="left"><img src="../images/Strategy2.JPG" width="1024" height="742"></p>
  <p align="left">Now we are going to make a simple AMAI strategy step by step and test it in game.<BR>
Start by giving it a name and report.<BR>
<img src="../images/Editor4.jpg" width="416" height="88"><BR>
<BR>
Next we have to make it build something. To prove how easy it is to make AMAI play with very little code i'm starting with only 2 lines in the tier 1 code.<BR>
<img src="../images/Editor5.jpg" width="491" height="111"></p>
  <p align="left">A hero and 10 footmen should be sufficient for some creeping and early attacks on the enemy, so let's test it.<BR>
Hit the 'OK' button to save this strategy as it is. You will find yourself back at the strategy editor where this strategy still has the name "New", to fix this just restart the program or switch to another race and switch back and the name "Test" should appear instead if that was the name you gave it.<BR>
Now to lock the computer to only use this strategy so we can test it you have to select it in the list and hit the 'Lock' button to the right.<BR>
After this we need to compile it, so hit the compile button to the left.<BR>
<BR>
After it has compiled just start the installer 'AMAI.exe' and install this version to a map of your choice so we can test it.<BR>
After this start Warcraft3 The Froxen Throne. (Unless it was a Reign of Chaos version you just did)<BR>
Go to Local Area Network and set up a game on the map you just installed this version of AMAI to with yourself as observer and bring up 2 human computers.</p>
  <p align="left"><img src="../images/Game1.jpg" width="814" height="226"></p>
  <p align="left">Start the game and check if everything is alright. If it works as it should both computers will tell you that they are using the test strategy you just made.<BR>
  <img src="../images/Game2.jpg" width="588" height="198"></p>
  <p align="left">Now the game should go on with 2 human computers creeping and attacking each other while both try to keep an army of 1 hero and 10 footmen.<BR>
As you can see all the buildings and workers are built automatically. The computers buy support units as zeppelins and maybe some mercenaries automatically as well and try to do some harass attacks.<BR>
<img src="../images/Game3.jpg" width="640" height="512"> </p>
  <p align="left">Since this strategy now is very simple the game will probably never end, both computers will just kill all creeps and then maybe don't even dare to attack each other since they got armies of equal size. This depends on what 2 profiles were picked for the 2 computers but is very likely to happen with this few units.<BR>
So get back to the editor and try to evolve your strategy a bit by adding an order to upgrade to tier 2. This is done by ordering the building name of the tier 2 hall, for human this is KEEP. </p>
  <p align="left"><img src="../images/Editor6.jpg" width="370" height="112"></p>
  <p align="left">And we don't want it to get to tier 2 for nothing so let's add some code in this tier as well so the computer continues to build when it gets there. </p>
  <p align="left"><img src="../images/Editor7.jpg" width="364" height="122"></p>
  <p align="left">Making the footmen level of attack and armor be upgraded to level2 as well as building a second hero and 5 riflemen should be good.<BR>
And remember to keep the footman order here if you still want the computer to keep a maximum of 10 footmen after it reaches tier 2 so it rebuilds any lost footmen.<BR>
<BR>
Now just repeat the previous steps to test this updated strategy. Hit 'OK', lock it again just in case, compile it and install it.<BR>
Run a test game again and notice how the computers upgrade the hall by the time they got the first hero and 2-3 footmen. After the hall is upgraded they should make a blacksmith to make the melee unit upgrades ordered in tier2 and to be able to build the 5 riflemen also ordered.</p>
  <p align="left"><img src="../images/Game4.jpg" width="640" height="512"></p>
  <p align="left">You might notice sooner or later that the computers will also build a shop no matter if you ordered it or not, this is becuse they want some items like potions and scroll of town portal automatically and the best way to get them is to build a shop and buy them there so thats what they do.</p>
  <p align="left"><img src="../images/Game5.jpg" width="640" height="512"></p>
  <p align="left">There are some additional build functions that might come in handy when you are trying to bring your strategy to perfection.<BR>
The first is 'BuildItem' that works just like 'BuildUnit' or 'BuildUpgr' but instead it takes an item and orders the computer to get the given amount of this item for any of the heroes.<BR>
<BR>
call BuildItem(<B>2, HEALING_POTION, 40</B>)<BR>
<BR>
This orders a computer to buy 2(<B>2</B>) healing potions(<B>HEALING_POTION</B>) using any hero to buy them at the priority of 40.(<B>40</B>)<BR>
<BR>
The second function is an advanced build function used to make your strategy a little more allround.<BR>
The name is 'SetBuildReact' and it's used to balance between 2 different unit types depending on how strong the enemy is in a certain area like this.<BR>
<BR>
call SetBuildReact(<B>20, 3, HUNTRESS, 5, ARCHER, enemy_unarmored, 4, 12, 50</B>)<BR>
<BR>
This command tells the computer to build 3(<B>3</B>) huntresses(<B>HUNTRESS</B>) and 5(<B>5</B>) archers(<B>ARCHER</B>) at all times but then spread a number of huntress and archers out on a food amount of 20(<B>20</B>) depending on how strong the enemy army is in the area of units with unarmored armor(<B>enemy_unarmored</B>).<BR>
if enemy unarmored strength is lower than 4(<B>4</B>) all this food becomes huntresses, if it's above 12 in strength(<B>12</B>) that food instead becomes archers only.<BR>
If the enemy unarmored strength is something between the 2 borders(<B>4</B> and <B>12</B>) the food amount is shared betweem both unit kinds.<BR>
For example if enemy unarmored strength is 8, 10 food will be huntress and 10 food will be archers.</p>
  <p align="left">For better detail about this command check the Reference Section</p>
  <p align="left">If you made it this far I don't think you should have any trouble to complete a whole strategy on your own but there are some things to have in mind when making an AMAI strategy.<BR>
<BR>
1. Only make goals and keep it simple to make AMAI work optimal as it's made to play on it's own.<BR>
<BR>
2. When making an AMAI strategy keep in mind that your strategy should have a special purpose and not be an all round strategy since AMAI will use many different strategies. An all round strategy is not good for AMAI since there is always another strategy that counters what the enemy got better than any allround strategy. Make a strategy that is good against for example air units and give it a high positive on anti air strength setting like 8 but at the same time the strategy is bad vs ground units and very bad vs ranged units with piercing attack so remember to give it negatives to anti normal strength like -3 and anti piercing strength like -5 so AMAI will know that this strategy is no good choise unless enemy really got lot of air units mostly.<BR>
<BR>
When you created your own strategy you might want to share it on internet and download other strategies made by other players to bring your AMAI closer to perfection. Read on to the next section to find out how to do this.</p>
  <p align="left"><em>NOTE: The reference section provides a reference about all the basic commands that can be used in the AMAI strategy manager. Use it if you need ideas or do not understand a command, or forgotten how to write it. </em><BR> 
    <BR> 
  </p>
</div>
</body>
</html>
